package com.java.util;

import javax.servlet.http.HttpSession;

/**
 * @ClassName UserUtil
 * @Description 获取当前登录的快递员信息
 * @Author 0715-YuHao
 * @Date 2020/9/11 17:51
 * @Version 1.0
 */
public class UserUtil {
    public static String getAdminUserName(HttpSession session) {
        return (String) session.getAttribute("adminUsername");
    }

    public static String getUserName(HttpSession session) {
        return (String) session.getAttribute("username");
    }

    public static String getUserPhone(HttpSession session) {
        return (String) session.getAttribute("userPhone");
    }

    public static String getLoginSms(HttpSession session, String userPhone) {
        return (String) session.getAttribute(userPhone);
    }

    public static void setLoginSms(HttpSession session, String userPhone, String code) {
        session.setAttribute(userPhone, code);
    }

    public static void setUserInfo(HttpSession session, int index) {
        session.setAttribute("userInfo", index);
    }

    public static int getUserInfo(HttpSession session) {
        return (int) session.getAttribute("userInfo");
    }
}
